Update ARM platform ports to use new bakery lock apis.
authorVikram Kanigiri <[email protected]>
Wed, 9 Sep 2015 09:52:13 +0000 (10:52 +0100)
committerVikram Kanigiri <[email protected]>
Fri, 11 Sep 2015 15:19:39 +0000 (16:19 +0100)
This patch updates ARM platform ports to use the new unified bakery locks
API. The caller does not have to use a different bakery lock API depending upon
the value of the USE_COHERENT_MEM build option.

NOTE: THIS PATCH CAN BE USED AS A REFERENCE TO UPDATE OTHER PLATFORM PORTS.

Change-Id: I1b26afc7c9a9808a6040eb22f603d30192251da7

include/plat/arm/common/arm_def.h
include/plat/arm/common/plat_arm.h

index 377bfaa222700f781de349881375f0ec04937339..98705ec6333bf9ce03447f8edd830755c891b34a 100644 (file)
  */
 #define CACHE_WRITEBACK_GRANULE                (1 << ARM_CACHE_WRITEBACK_SHIFT)
 
-#if !USE_COHERENT_MEM
-/*
- * Size of the per-cpu data in bytes that should be reserved in the generic
- * per-cpu data structure for the ARM platform port.
- */
-#define PLAT_PCPU_DATA_SIZE            2
-#endif
-
 
 /*******************************************************************************
  * BL1 specific defines.
 #define TSP_IRQ_SEC_PHY_TIMER          ARM_IRQ_SEC_PHY_TIMER
 
 
+/*
+ * One cache line needed for bakery locks on ARM platforms
+ */
+#define PLAT_PERCPU_BAKERY_LOCK_SIZE           (1 * CACHE_WRITEBACK_GRANULE)
+
+
 #endif /* __ARM_DEF_H__ */
index 823212cb3a356f0420c85ef8b3fd9664961a6a23..ad41f4f0a1829dc479f61fa4e7734029ebedeeef 100644 (file)
@@ -71,14 +71,11 @@ void arm_configure_mmu_el3(unsigned long total_base,
 );
 
 #if IMAGE_BL31
-#if USE_COHERENT_MEM
-
 /*
  * Use this macro to instantiate lock before it is used in below
  * arm_lock_xxx() macros
  */
-#define ARM_INSTANTIATE_LOCK   bakery_lock_t arm_lock  \
-       __attribute__ ((section("tzfw_coherent_mem")));
+#define ARM_INSTANTIATE_LOCK   DEFINE_BAKERY_LOCK(arm_lock);
 
 /*
  * These are wrapper macros to the Coherent Memory Bakery Lock API.
@@ -89,58 +86,9 @@ void arm_configure_mmu_el3(unsigned long total_base,
 
 #else
 
-/*******************************************************************************
- * Constants to specify how many bakery locks this platform implements. These
- * are used if the platform chooses not to use coherent memory for bakery lock
- * data structures.
- ******************************************************************************/
-#define ARM_MAX_BAKERIES       1
-#define ARM_PWRC_BAKERY_ID     0
-
-/* Empty definition */
-#define ARM_INSTANTIATE_LOCK
-
-/*******************************************************************************
- * Definition of structure which holds platform specific per-cpu data. Currently
- * it holds only the bakery lock information for each cpu.
- ******************************************************************************/
-typedef struct arm_cpu_data {
-       bakery_info_t pcpu_bakery_info[ARM_MAX_BAKERIES];
-} arm_cpu_data_t;
-
-/* Macro to define the offset of bakery_info_t in arm_cpu_data_t */
-#define ARM_CPU_DATA_LOCK_OFFSET       __builtin_offsetof\
-                                           (arm_cpu_data_t, pcpu_bakery_info)
-
-
-/*******************************************************************************
- * Helper macros for bakery lock api when using the above arm_cpu_data_t for
- * bakery lock data structures. It assumes that the bakery_info is at the
- * beginning of the platform specific per-cpu data.
- ******************************************************************************/
-#define arm_lock_init()                /* No init required */
-#define arm_lock_get()         bakery_lock_get(ARM_PWRC_BAKERY_ID,     \
-                                       CPU_DATA_PLAT_PCPU_OFFSET +     \
-                                       ARM_CPU_DATA_LOCK_OFFSET)
-#define arm_lock_release()     bakery_lock_release(ARM_PWRC_BAKERY_ID, \
-                                       CPU_DATA_PLAT_PCPU_OFFSET +     \
-                                       ARM_CPU_DATA_LOCK_OFFSET)
-
 /*
- * Ensure that the size of the platform specific per-cpu data structure and
- * the size of the memory allocated in generic per-cpu data for the platform
- * are the same.
+ * Empty macros for all other BL stages other than BL3-1
  */
-CASSERT(PLAT_PCPU_DATA_SIZE == sizeof(arm_cpu_data_t),
-       arm_pcpu_data_size_mismatch);
-
-#endif /* USE_COHERENT_MEM */
-
-#else
-
-/*
-* Dummy macros for all other BL stages other than BL3-1
-*/
 #define ARM_INSTANTIATE_LOCK
 #define arm_lock_init()
 #define arm_lock_get()